package com.ruoyi.project.treat.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.treat.domain.SystemDept;
import com.ruoyi.project.treat.domain.SystemTregistraFee;
import com.ruoyi.project.treat.domain.TreatPatient;
import com.ruoyi.project.treat.domain.TreatRegister;
import com.ruoyi.project.treat.service.ITreatRegisteredService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/treat/registered")
public class TreatRegisteredController extends BaseController {
    @Autowired
    private ITreatRegisteredService registeredService;

    /**
     * 查询出所有的挂号类型
     * @return
     */
    @GetMapping("/RegistraFee/guahao")
    @PreAuthorize("@ss.hasPermi('treat:registered:list')")
    public AjaxResult getByRegistraFeeList(){
        List<SystemTregistraFee> list = registeredService.selectSystemTregistraFeeList();
        System.out.println(list);
        return AjaxResult.success(list);
    }

    /**
     * 根据挂号类型查询对应的挂号费用
     * @param registraName
     * @return
     */
    @GetMapping("/RegistraFee/{registraName}")
    @PreAuthorize("@ss.hasPermi('treat:registered:list')")
    public AjaxResult getByRegistraFeeName(@PathVariable String registraName){
        SystemTregistraFee registraFee = registeredService.selectSystemTregistraFee(registraName);
        return AjaxResult.success(registraFee);
    }

    /**
     * 获取科室列表
     */
    @PreAuthorize("@ss.hasPermi('treat:registered:list')")
    @GetMapping("/deptlist")
    public TableDataInfo list(SystemDept dept)
    {
        startPage();
        List<SystemDept> list = registeredService.selectSystemDeptList(dept);
        return getDataTable(list);
    }
}
